package cn.tedu.project.oa.attendanceRule.service.impl;

import cn.tedu.project.oa.attendanceRule.mapper.OvertimeRuleMapper;
import cn.tedu.project.oa.attendanceRule.pojo.entity.OvertimeRule;
import cn.tedu.project.oa.attendanceRule.service.IOvertimeRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class OvertimeRuleServiceImpl implements IOvertimeRuleService {
    @Autowired
    private OvertimeRuleMapper overtimeRuleMapper;

    /**
     * 查询加班规则
     *
     * @param id 加班规则主键
     * @return 加班规则
     */
    @Override
    public OvertimeRule selectOvertimeRuleById(Long id)
    {
        return overtimeRuleMapper.selectOvertimeRuleById(id);
    }

    /**
     * 查询加班规则列表
     *
     * @param overtimeRule 加班规则
     * @return 加班规则
     */
    @Override
    public List<OvertimeRule> selectOvertimeRuleList(OvertimeRule overtimeRule)
    {
        return overtimeRuleMapper.selectOvertimeRuleList(overtimeRule);
    }

    /**
     * 新增加班规则
     *
     * @param overtimeRule 加班规则
     * @return 结果
     */
    @Override
    public int insertOvertimeRule(OvertimeRule overtimeRule)
    {
        overtimeRule.setCreateTime(new Date());
        return overtimeRuleMapper.insertOvertimeRule(overtimeRule);
    }

    /**
     * 修改加班规则
     *
     * @param overtimeRule 加班规则
     * @return 结果
     */
    @Override
    public int updateOvertimeRule(OvertimeRule overtimeRule)
    {
        overtimeRule.setUpdateTime(new Date());
        return overtimeRuleMapper.updateOvertimeRule(overtimeRule);
    }

    /**
     * 批量删除加班规则
     *
     * @param ids 需要删除的加班规则主键
     * @return 结果
     */
    @Override
    public int deleteOvertimeRuleByIds(Long[] ids)
    {
        return overtimeRuleMapper.deleteOvertimeRuleByIds(ids);
    }

    /**
     * 删除加班规则信息
     *
     * @param id 加班规则主键
     * @return 结果
     */
    @Override
    public int deleteOvertimeRuleById(Long id)
    {
        return overtimeRuleMapper.deleteOvertimeRuleById(id);
    }
}
